package es.andanda.smartwatch;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import es.andanda.smartwatch.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class MainActivity extends Activity {
	Integer i = 0;
 
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
  

  Runnable helloRunnable = new Runnable() {
	    public void run() {
	    	i++;
	    	System.out.println("alvaro"+i);
	    }
	};
 }
 private void envia(String i) {
		Intent serviceIntent = new Intent(this, AndandaExtensionService.class);
      serviceIntent.setAction(AndandaExtensionService.INTENT_ACTION_ADD);
      EditText etName = (EditText) findViewById(R.id.etTitle);
      EditText etMsg = (EditText) findViewById(R.id.etMessage);
      serviceIntent.putExtra("name", i);
      serviceIntent.putExtra("message", i);
      startService(serviceIntent);
		
	}
 
 public void buttonClicked(View v){
  if(v.getId() == R.id.btnSend){
   Intent serviceIntent = new Intent(this, AndandaExtensionService.class);
         serviceIntent.setAction(AndandaExtensionService.INTENT_ACTION_ADD);
         EditText etName = (EditText) findViewById(R.id.etTitle);
         EditText etMsg = (EditText) findViewById(R.id.etMessage);
         serviceIntent.putExtra("name", etName.getText().toString()+"44");
         serviceIntent.putExtra("message", etMsg.getText().toString());
         startService(serviceIntent);
  }
  else if(v.getId() == R.id.btnClearn){
   Intent serviceIntent = new Intent(this, AndandaExtensionService.class);
         serviceIntent.setAction(AndandaExtensionService.INTENT_ACTION_CLEAR);
         startService(serviceIntent);
  }
  
 }


	
}
